package com.tanhua.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {



    @Select("select COUNT(distinct user_id) from tb_log where type=#{type} and log_time=#{today}")
    Integer findNumRegistered(@Param("today") String today, @Param("type") String s);


    @Select("select COUNT(distinct user_id) from tb_log where type=#{type} and log_time=#{today}")
    Integer findNumLogin(@Param("today") String today, @Param("type") String s);


    @Select("select COUNT(distinct user_id) from tb_log where log_time=#{today}")
    Integer findNumActive(@Param("today") String today);


    @Select("select COUNT(distinct user_id) from tb_log where log_time=#{today}\n" +
            "and user_id in\n" +
            "(\n" +
            " select distinct user_id from tb_log where type='0102' and log_time=#{yesterday}\n" +
            ")")
    Integer findNumRetention1d(@Param("yesterday") String yesterday, @Param("today") String today);


}
